Skip to content

Upgrade OpenTelemetry to 1.58.0 / 2.24.0#4606

Draft
Copilot wants to merge 10 commits intomainfrom
copilot/update-opentelemetry-versions
Draft

Upgrade OpenTelemetry to 1.58.0 / 2.24.0#4606
Copilot wants to merge 10 commits intomainfrom
copilot/update-opentelemetry-versions

Conversation

Copy link
Contributor

Copilot AI commented Jan 28, 2026

Upgrades OpenTelemetry SDK from 1.55.0 to 1.58.0 and Instrumentation from 2.21.0 to 2.24.0. The upgrade introduced breaking internal API changes and a new io.opentelemetry.common package that required build and configuration fixes.

Breaking API Changes

AgentInstrumentationConfig removal
Upstream removed the internal config API. Migrated to DeclarativeConfigUtil with system property fallback:

// Before
String value = AgentInstrumentationConfig.get().getString(key);

// After
DeclarativeConfigProperties config = 
    DeclarativeConfigUtil.getInstrumentationConfig(GlobalOpenTelemetry.get(), "module");
String value = config.getString(key);
if (value == null) {
  value = System.getProperty(key);  // Preserves -D flag support
}

LoggingCustomizer interface
Method signature changed from init(EarlyInitAgentConfig) to init().

Context propagation
GlobalOpenTelemetry.getPropagators() unreliable in test environments. Azure Functions instrumentation now uses W3CTraceContextPropagator.getInstance() directly.

Build Fixes

LinkageError resolution
The new io.opentelemetry:opentelemetry-common dependency was included both from upstream javaagent (already shaded) and our dependencies, causing loader constraint violations. Excluded from our javaagent libs:

dependencies {
  exclude(dependency("io.opentelemetry:opentelemetry-common"))
}

Double relocation prevention
Added exclusions in shadow conventions to skip classes already shaded by upstream (io.opentelemetry.javaagent.shaded.*).

Configuration Timing Fix

Instrumentation modules load before AiConfigCustomizer runs. Properties from the customizer (custom instrumentation, micrometer config) must also be set as system properties for early access:

properties.put("applicationinsights.internal.methods.include", config);
System.setProperty("applicationinsights.internal.methods.include", config);
Original prompt

val otelSdkVersion = "1.58.0"
val otelInstrumentationAlphaVersion = "2.24.0-alpha"
val otelInstrumentationVersion = "2.24.0"


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 28, 2026 19:58
…rors)

Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Copilot AI changed the title [WIP] Update OpenTelemetry SDK and instrumentation versions Upgrade OpenTelemetry to 1.58.0 / 2.24.0 Jan 28, 2026
Copilot AI requested a review from xiang17 January 28, 2026 20:19
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Copilot AI changed the title Upgrade OpenTelemetry to 1.58.0 / 2.24.0 Add system property fallback to DeclarativeConfigUtil config access Jan 28, 2026
Copilot AI and others added 2 commits February 4, 2026 23:27
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
After OpenTelemetry upgrade to 2.24.0, GlobalOpenTelemetry.getPropagators()
doesn't work correctly in test environments. Changed to use
W3CTraceContextPropagator.getInstance() directly for context extraction.

Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Copilot AI changed the title Add system property fallback to DeclarativeConfigUtil config access Fix Azure Functions context propagation after OpenTelemetry 2.24.0 upgrade Feb 4, 2026
Copilot AI and others added 2 commits February 5, 2026 00:31
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
The upstream OpenTelemetry javaagent already includes io.opentelemetry.common
classes (properly shaded). Our build was including the same classes, causing
classloader conflicts. Added exclusion to prevent double inclusion.

Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Copilot AI changed the title Fix Azure Functions context propagation after OpenTelemetry 2.24.0 upgrade Upgrade OpenTelemetry to 1.58.0 / 2.24.0 Feb 5, 2026
AiConfigCustomizer properties need to be accessible by instrumentation modules
that load early. Setting them as system properties ensures they're available
through the System.getProperty() fallback mechanism.

Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants